Windows Update Command Line Troubleshooting
The Windows Update Command Line Troubleshooting repository will contain information and use cases for troubleshooting methodoligies and interactions with Windows Update via Powershell and Command Line
Get-Hotfix Commands
Getting All Updates Done since Begining of Year
Get-Hotfix | Where-Object {$_.InstalledOn -gt "1/1/2026"} | Sort-Object -Property InstalledOn -Descending | Format-Table -AutoSize
Getting All Updates - Sorted by Date
Get-Hotfix | Sort-Object -Property InstalledOn -Descending | Format-Table -AutoSize
Getting All Updates via Windows Update API Query
$Session = New-Object -ComObject "Microsoft.Update.Session";
$Searcher = $Session.CreateUpdateSearcher();
$historyCount = $Searcher.GetTotalHistoryCount();
$Searcher.QueryHistory(0, $historyCount) | Select-Object Title, Date, ClientApplicationID, @{name="Operation"; expression={switch($_.operation){ 1 {"Installation"}; 2 {"Uninstallation"}; 3 {"Other"} }}}, Description | Out-GridView
DISM Guide
DISM (Deployment and Imaging Service Module) is utilized for performing OS Repairs, Component Servicing, and other Repair Operations for Operating System Utilization
DISM Repair Commands - Online
These commands utilize DISM in order to scan and repair functions and components on a computer
Check for Detected Corruption: Performs a quick check on the system for any previously flagged component store items which were marked as corrupted
DISM /Online /Cleanup-Image /CheckHealth
Scan the Component Store for Corruption: Performs a Deep Scan on the Component Store for Corruption which has not been flagged yet
DISM /Online /Cleanup-Image /ScanHealth
Scan and Repair System Corruption: Scans the Component Store and Repairs found Corruption Automatically
DISM /Online /Cleanup-Image /RestoreHealth
DISM Repair Commands - Local Source (ISO File)
The following commands work like the Online Commands but use targeting of a Local ISO to repair components
Get Index for Windows Version for ISO: This command pulls the Index #s from a ISO File for the versioning of Windows it contains - This is necessary for doing any repair functionality
DISM /Get-WimInfo /Wimfile:{DriveLetter of Mounted ISO}:\sources\install.wim
Repairing System with Local ISO Files: This command utilizes the local ISO file in order to repair found corruption
DISM /Cleanup-Image /RestoreHealth /Source:WIM:{DriveLetter of Mounted ISO}:\sources\install.wim:{1,2,3,4 Index Version from Command Above}
You can add /LimitAccess to the end of the local command to have it replace only the corrupted files. Without it, all component files are replaced
DISM Reporting
These Reporting Commands are utilized to output all packages on the machine
DISM /Online /Get-Packages /format:table
DISM /Online /Get-Packages /format:table > "C:\temp\packages.csv"
DISM Package Removal
These commands will remove packages which are found using the reporting commands above
DISM /Online /Remove-Package /PackageName:[Name of Package]